{extend name="common:base" /}
{block name="content"}
<div class="row">
    <a class="btn btn-info" href="{:url('index',['act'=>'add'])}" value="">新增</a>
</div>
<div class="space-4"></div>
<div class="row">
    <form id="form" method="post" action="{:url('index',['act'=>'del'])}">
        <table class="table table-striped table-bordered table-hover">
        <thead>
            <tr>
                <th class="center"><input class="check-all" type="checkbox" value=""></th>
                <th>菜单名称</th>
                <th>链接</th>
                <th class="center hidden-sm hidden-xs">ICON</th>
                <th class="center hidden-sm hidden-xs">状态</th>
                <th class="center hidden-sm hidden-xs">排序</th>
                <th class="center">操作</th>
            </tr>
        </thead>
        <tbody>
        {volist name="list" id="val"}
            <tr>
                <td class="center">
                    <input class="ids" type="checkbox" name="ids[]" value="{$val.id}">
                </td>
                <td>{$val.title}</td>
                <td>{$val.url}</td>
                <td class="center hidden-sm hidden-xs"><i class="{$val.icon}"></i></td>
                <td class="center hidden-sm hidden-xs">{if condition="$val.status eq 1"}<i class="fa fa-eye" title="可见"></i>{else /}<i class="fa fa-eye-slash red" title="已隐藏"></i>{/if}</td>
                <td class="center hidden-sm hidden-xs">{$val.o}</td>
                <td class="center"><a class="ace-icon fa fa-edit" href="{:url('index',['act'=>'edit','id'=>$val['id']])}">修改</a></td>
            </tr>
        {/volist}
        </tbody>
    </table>
    </form>
</div>
<div class="row">
    <input id="submit" class="btn btn-info" type="button" value="删除">
</div>
<div class="row">
{$list->render()|raw}
</div>
{/block}
{block name="js_file"}
<script src="__STATIC__/admin/js/bootbox.js"></script>
{/block}
{block name="javascript"}
<script type="text/javascript">
$(function(){
    $(".check-all").click(function(){
        $(".ids").prop("checked", this.checked);
    });
    $(".ids").click(function(){
        var option = $(".ids");
        option.each(function(i){
            if(!this.checked){
                $(".check-all").prop("checked", false);
                return false;
            }else{
                $(".check-all").prop("checked", true);
            }
        });
    });
    $("#submit").click(function(){
        bootbox.confirm({
            title: "系统提示",
            message: "确定要删除所选记录？",
            callback:function(result){
                if(result){
                    $("#form").submit();
                }
            },
            buttons: {
                "cancel" : {"label" : "取消"},
                "confirm" : {
                        "label" : "确定",
                        "className" : "btn-danger"
                    }
            }
        });
    });
})
</script>
{/block}
